import {AxiosResponse} from "axios";
import {Result} from "@/types/api-common";
import api from "./init";
import {ExpoPushTokenPayload} from "@/types/expo-push-token";

/**
 * 检查指定设备的 Expo Push Token 是否存在
 * @param deviceId 设备ID
 * @returns {Promise<AxiosResponse<Result<boolean>>>}
 */
export const checkExpoPushToken = (deviceId: string): Promise<AxiosResponse<Result<boolean>>> => {
    return api.get(`/expopushtoken/check/${deviceId}`);
};

/**
 * 新增或更新 Expo Push Token
 * @param params 包含设备ID和Expo Push Token的参数
 * @returns {Promise<AxiosResponse<Result<any>>>}
 */
export const upsertExpoPushToken = (params: ExpoPushTokenPayload): Promise<AxiosResponse<Result<any>>> => {
    return api.post(`/expopushtoken`, params);
};